export default {
  mounted(el, binding) {
    const { textContent } = el;
    const { value } = binding;
    el.bindValue = value;
    if (typeof value === "function") {
      el.bindValue = value();
    }
    el.setAttribute("title", el.bindValue || textContent);
  },
  updated(el, binding) {
    const { textContent } = el;
    const { value } = binding;
    el.bindValue = value;
    if (typeof value === "function") {
      el.bindValue = value();
    }
    el.setAttribute("title", el.bindValue || textContent);
  },
  unmounted(el) {
    el.bindValue = null;
  },
};
